If you are writing scripts using a real external Windows Phone device, you can simulate key events using the SendText command.
The following keys can be used with the "SendText" command:
Emulating the ‘Back’ key: {ESC}
Deleting text: {BKSP}
Unlocking the device if it is actually locked: {UNLOCK}
Switching to the home screen: {HOME}
Closing the keyboard on the device: {CLOSEKEYBOARD}
For toggling orientation:
To landscape: {LANDSCAPE}
To Portrait: {PORTRAIT}